import request from '@/utils/request'
export default{
  getoriginList(searchModel) {
    const params = {};
    if (searchModel.coid) {
      params.coid = searchModel.coid;
    }
    params.pageNo = searchModel.pageNo;
    params.pageSize = searchModel.pageSize;
    return request({
      url: '/origin/List',
      method: 'get',
      params: params
    });
  },
  deleteOrigin(coid){
    return request({
        url: `/origin/${coid}`,
        method: 'delete',
      });
},
   updateOrigin(origin){
    return request({
      url: `/origin/`,
      method: 'put',
      data: origin
    })
   },
   getByCoId(coid){
    return request({
      url: `/origin/${coid}`,
      method: 'get'
    });
  },
  saveOrigin(origin){
    if(origin.coid == null || origin.coid == undefined){
      return this.addOrigin(origin);
    }
    return this.updateOrigin(origin);
  },
  // 新增
  addOrigin(origin){
    return request({
      url: '/origin',
      method: 'post',
      data: origin
    });
  },

}